{extend name="admin@public/base_content" /}
{block name="style"}
<link rel="stylesheet" type="text/css" href="__ADMIN__/css/font/demo.css">
{/block}
{block name="body">}
<body>
{include file="admin@public/common" /}
<div class="container-fluid larry-wrapper">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form layui-form-pane" action="{:url('')}">
                    <div class="layui-form-item">
                        <label class="layui-form-label">菜单组</label>
                        <div class="layui-input-inline">
                            <select class="tpl-form-input" jq-verify="required" jq-error="请选择用户组" lay-filter="pid" name="pid">
                                <option value="0">顶级菜单</option>
                                {foreach name="menuList" item="vo"}
                                <option value="{$vo.id}" {if condition="$vo.id eq $info.pid"}selected{/if}>{$vo.cname}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">菜单名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" value="{$info.name|default=''}" jq-verify="required" jq-error=" 请输入菜单名" placeholder="请输入菜单名" class="layui-input ">
                        </div>
                    </div>

                    {neq name='info.rs' value='2'}
                    <div class="layui-form-item">
                        <label class="layui-form-label">地址url</label>
                        <div class="layui-input-block">
                            <input type="text" name="url" value="{$info.url|default=''}" jq-verify="" jq-error="请输入地址url" placeholder="请输入地址url" class="layui-input ">
                        </div>
                    </div>
                    {/neq}
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">选择图标</label>
                        <div class="layui-input-block" >
                            {foreach name='iconFont' item='vo'}
                            <input type="radio" name="iconfont" {eq name="info.iconfont" value="$vo.code"}checked{/eq} title='<i class="iconfont">&{$vo.code}</i>' value="{$vo.code}"/>
                            {/foreach}
                        </div>
                    </div>

                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="status" {eq name="info.status" value="1"}checked{/eq} title="正常" value="1" checked />
                            <input type="radio" name="status" {eq name="info.status" value="2"}checked{/eq} title="禁用" value="2" />
                        </div>
                    </div>
                    <div id="act">
                        <div class="layui-form-item">
                            <label class="layui-form-label">操作内容</label>
                            <button class="layui-btn" id='add_act' type="button">新增</button>
                        </div>
                        {foreach name='info.act' item='vo'}
                        <div class="layui-form-item">
                            <label class="layui-form-label">名称</label>
                            <div class="layui-input-inline">
                                <input name="act[{$key}][name]" value="{$vo.name}" placeholder="请输入" class="layui-input " type="text"></div>
                            <label class="layui-form-label">方法</label>
                            <div class="layui-input-inline" style='width: 500px;'>
                                <input name="act[{$key}][act]" value="{$vo.act}" placeholder="请输入" class="layui-input" type="text"></div>
                            <button class="layui-btn layui-btn-danger del_act" onclick="del_act(this)" type="button">-</button>
                        </div>
                        {/foreach}
                    </div>
                    <div class="layui-input-block">
                        <input type="hidden" name="id" type="hidden" value="{$info.id|default=''}">
                        <button class="layui-btn" jq-submit lay-filter="submit" jq-tab="true">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </form>
            </section>
        </div>
    </div>
</div>
</body>
{/block}
{block name="script"}
<script>
    var num="{$start_act|default='1'}";
    layui.use('myform', function(){
        var form = layui.form();
        var $= layui.jquery;
        $("#add_act").click(function() {
            $("#act").append(
                    "<div class='layui-form-item'>" +
                    "<label class='layui-form-label'>名称</label>" +
                    "<div class='layui-input-inline'>" +
                    "<input type='text' name='act["+num+"][name]' value='' placeholder='请输入' class='layui-input '>" +
                    "</div>" +
                    "<label class='layui-form-label'>方法</label>" +
                    "<div class='layui-input-inline' style='width: 500px;'>" +
                    "<input type='text' name='act["+num+"][act]' value='' placeholder='请输入' class='layui-input'>" +
                    "</div>" +
                    "<button class='layui-btn layui-btn-danger del_act'  onclick='del_act(this)' type='button'>-</button>" +
                    "</div>");
            num++;
        });
    });
    function del_act(obj) {
        var $= layui.jquery;
        $(obj).parent().remove();
        num--;
    }

</script>
{/block}